#ifndef _GFS_SERVICES_H
#define _GFS_SERVICES_H

// SUPER USER GFS
int GFS_SUPER_USER;

// MIRRORING
int MIRROR;

// CHUNKS
//int CHUNKS;

#include "gfsGlobal.h" 
//////////////////////////////////////////// METADATA /////////////////////////////////////////////
extern int gfs_init_metadata();
extern int gfs_open_metadata();


///////////////////////////////////////// SERVER METADATA /////////////////////////////////////////
extern int gfs_get_available_server(GFS_server *server); //by refference
extern int gfs_connect_server(char *server_url);


//////////////////////////////////////////// FILE METADATA ////////////////////////////////////////
extern int gfs_getFileLocation(GFS_file file); //by refference
extern int gfs_saveFileMetadata(GFS_file file); //by refference
extern int gfs_moveFileMetadata(GFS_file src_file, GFS_file dst_file);
extern int gfs_getFileLocationMove(GFS_file src_file, GFS_file dst_file); //by refference


///////////////////////////////////////// DIRECTORY METADATA //////////////////////////////////////
extern int gfs_saveDirMetadata(GFS_dir dir); //by refference
extern int gfs_moveDirMetadata(GFS_dir src_dir, GFS_dir dst_dir);
extern int gfs_isDirExist(GFS_dir dir);
extern int gfs_getItemList(GFS_dir dir, GFS_item *item); //by refference

//////////////////////////////////////// LOCK & PERMISSION ////////////////////////////////////////
extern int gfs_lockMetadata(char *lock_mode, char *access_mode, int book, char *item_name, char *logical_loc);
extern int gfs_unlockMetadata(int pid, int unbook, char *item_name, char *logical_loc);
extern int gfs_get_permission_location(char* logical_path, char *mode);
extern int gfs_get_permission(char *item_name, char* logical_location, char *mode);
extern int gfs_change_permission(char *item_name, char *logical_location, char *mode);
extern int gfs_superuser_check(char *strPassword);
extern int gfs_superuser_chpwd(char *strOldPassword, char *strNewPassword);


#endif /* _GFS_SERVICES_H */
